package com.googlecode.agscrum.model.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.SequenceGenerator;

import org.hibernate.validator.NotEmpty;
import org.hibernate.validator.NotNull;

@Entity
@SequenceGenerator(name = "file_sequence", sequenceName = "file_sequence")
public class File {
	@Id
	@GeneratedValue(generator = "file_sequence", strategy = GenerationType.SEQUENCE)
	@Column(name = "id_file")
	private Long id;
	@Column(length = 30, nullable = false)
	@NotNull(message = "file.name.required")
	@NotEmpty(message = "file.name.required")
	private String name;
	@Column(length = 500)
	private String description;
	@Column(nullable = false)
	@NotNull(message = "file.date.required")
	private Date date;
	@Lob
	@Column(nullable = false)
	private byte[] data;
	@Column(nullable = false)
	@NotNull(message = "file.date.required")
	private String type;

	private Long length;
}
